package com.hudson.plugin.ccheck.domain.dao;

import com.hudson.plugin.ccheck.internal.domain.entity.CcheckresultEntity;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * User: yuxinlei
 * Date: 5/30/11
 * Time: 6:50 PM
 */
public interface CcheckresultDAOInterface {
    // property constants
    String BUILD_ID = "buildId";
    String SCORE = "score";
    String SUMMARY = "summary";
    String RESULT_REASON = "resultReason";
    String DETAILS = "details";
    String DISPLAY_NAME = "displayName";

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void save(CcheckresultEntity transientInstance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void delete(CcheckresultEntity persistentInstance);

    CcheckresultEntity findById(Integer id);

    List findByProperty(String propertyName, Object value);

    List<CcheckresultEntity> findByBuildId(Object buildId);

    List<CcheckresultEntity> findByScore(Object score);

    List<CcheckresultEntity> findBySummary(Object summary);

    List<CcheckresultEntity> findByResultReason(Object resultReason);

    List<CcheckresultEntity> findByDetails(Object details);

    List<CcheckresultEntity> findByDisplayName(Object displayName);

    List findAll();

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    CcheckresultEntity merge(CcheckresultEntity detachedInstance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void attachDirty(CcheckresultEntity instance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void attachClean(CcheckresultEntity instance);

    List<Integer> findCCheckResultIdByBuildsId(Integer buildId);
}
